﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BBB.Valuta
{
    public partial class InputTime : Form
    {
        public InputTime()
        {
            InitializeComponent();
        }

        public DialogResult ShowDialog(out DateTime time)
        {
            DialogResult result = ShowDialog();
            
            if (result == DialogResult.OK && DateTime.TryParse(timeMaskedTextBox.Text, out time))
            {
                return result;
            }
            else
            {
                time = DateTime.Now;
                MessageBox.Show("Невірно введений час");
                return DialogResult.Cancel;
            }
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
        }
    }
}
